package enum_;

/**
 * @author green-citrus
 * @version 1.0
 */
public class EnumExercise02 {
    public static void main(String[] args) {
        //获取到所有的枚举对象，即数组
        Week[] values = Week.values();
        //遍历，使用增强for
        System.out.println("===所有星期的信息如下===");
        for(Week week : values) {
            System.out.println(week);
        }
    }
}

/*
声明Week枚举类，其中包含星期一至星期口的定义；
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY;
使用values 返回所有的枚举数组，并遍历，输出左图效果
*/
enum Week {
    //定义Week的枚举对象+
    MONDAY("星期一"), TUESDAY("星期二"), WEDNESDAY("星期三"), THURSDAY("星期四")
    , FRIDAY("星期五"), SATURDAY("星期六"), SUNDAY("星期天");
    private String name;

    private Week(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }
}